import storage from "@/utils/storage";
import { useState, useEffect } from "react";
import { getGoodsList, getGoodsListDetail } from "@/service/user";



export async function GoodsList(token,status) {
  
  let obj = {
    status,
    token,
  };
  const res = await getGoodsList(obj);
  if(!res.data) return []
  const arr=await Promise.all(
    res.data.orderList.map((item) => {
      return new Promise(async (resolve, reject) => {
        let obj = {
          id: item.id,
          token,
        };
        const detail = await getGoodsListDetail(obj);
        resolve(detail.data);
      });
    })
  )

  return arr

}
